package com.hyuk.hyukfgw.runner;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;

@Slf4j
@EnableDubbo
@EnableDiscoveryClient
@EnableCaching
@SpringBootApplication(scanBasePackages = "com.hyuk.hyukfgw")
public class Bootstrap {
    
    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Bootstrap.class);
        String serverPort = applicationContext.getEnvironment().getProperty("server.port");
        String appName = applicationContext.getEnvironment().getProperty("app.name");
        
        RedisTemplate bean = applicationContext.getBean(RedisTemplate.class);
        System.out.println(bean);
        log.info("[hyukfgw-http] Start success, appName : {}, serverPort : {}", appName, serverPort);
    }
}
